Repository navigation
Conversation
OWM /forecast items carry pop (0-1); surface it as precipitationProbability (0-100) on forecast[] (daily max) and hourly[], via payload.js and summarizeForecast. Home Assistant has no equivalent and the demo snapshot has none, so both stay null and the client hides the field when absent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
OpenWeatherMap's
/forecastitems already carrypop(probability of precipitation, 0–1), but the canonical weather payload ignored it. This change surfaces it asprecipitationProbability, an integer percent (0–100):forecast[]— each day takes the maximumpopacross its 3-hour blocks (the day's likeliest block).hourly[]— each 3-hour point carries its ownpop, converted to a percent.payload.js— the canonical payload now carries the field on both arrays, andvalidatePayloadrejects values outside 0–100 (a value like 140 is a provider bug, not a display value).nullfor the field, which stays valid. The widget hides the value when it is absent, so this is safe to land independently of the widget change that renders it.Payload example
From the payload-contract test in
server/tests/weatherProviders.test.js, which builds a payload with a 60% daily probability and a 20% hourly probability and assertsvalidatePayloadpasses:{ "forecast": [ { "date": "2026-07-08", "high": 70, "low": 60, "condition": "rainy", "precipitation": 2, "precipitationProbability": 60 } ], "hourly": [ { "timestamp": 1783536000, "temp": 65, "precipitation": 0, "precipitationProbability": 20 } ] }The OpenWeatherMap fixture test covers the conversion itself: a
popof 0.6 on the likeliest 3-hour block becomes 60 on both that hourly point and its day, while the second day peaks at apopof 0.25 and becomes 25. When OpenWeatherMap sends nopop, the field isnullon both arrays.Tests
Verified locally on the rebased branch:
cd server && npm test).summarizeForecastconversion, missingpopstaysnull, payload contract + validation).cd client && npm test).cd client && npm run build, built in 6.40s).Generated with Muse AI 🤖